s = "hello world hello python"
# 将所有的"hello"替换为"hi"
new_s1 = s.replace("hello", "hi")
print(new_s1)  
# 将前1个"hello"替换为"hi"
new_s2 = s.replace("hello", "hi", 1)
print(new_s2)  

import re
s = "Hello World hello Python"
# 将所有不区分大小写的"hello"替换为"hi"
new_s = re.sub(r"hello", "hi", s, flags=re.IGNORECASE)
print(new_s)  